import request from '@/utils/request'
// 新增项目
export function submitProjectDefine(data) {
  return request({
    url: '/hljt-api/projectDefine/saveCascade',
    method: 'post',
    data
  })
}
// 展开
export function getProgress(params) {
  return request({
    url: '/hljt-api/projectDefine/node/progress',
    method: 'get',
    params
  })
}
// 删除项目
export function deleteProjectDefine(data) {
  return request({
    url: `/hljt-api/projectDefine/${data.id}`,
    method: 'delete'
  })
}
// 删除项目阶段
export function deleteProjectNode(data) {
  return request({
    url: `/hljt-api/projectNode/${data.id}`,
    method: 'delete'
  })
}

// 删除项目产品
export function deleteProjectProduct(data) {
  return request({
    url: `/hljt-api/projectProduct/${data.id}`,
    method: 'delete'
  })
}

// 获取项目列表
export function getProjectDefine(params) {
  return request({
    url: '/hljt-api/projectDefine/pages',
    method: 'get',
    params
  })
}
// 获取子任务列表
export function getProjectNodeReport(params) {
  return request({
    // url: '/hljt-api/projectNodeTask/pages',
    url: '/hljt-api/projectNode/pages',
    method: 'get',
    params
  })
}
// 获取项目进度
export function getProjectNodeTaskReport(params) {
  return request({
    url: '/hljt-api/projectNodeTaskReport/pages',
    method: 'get',
    params
  })
}
// 更新子任务
export function postProjectNodeTaskReport(data) {
  return request({
    url: '/hljt-api/projectNodeTaskReport',
    method: 'post',
    data
  })
}
// 获取人员
export function getUsers(params) {
  return request({
    url: '/hljt-api/users/pages',
    method: 'get',
    params
  })
}
// 获取物料列表
export function getMaterials(params) {
  return request({
    url: '/hljt-api/materials/pages',
    method: 'get',
    params
  })
}
// 获取客户列表
export function getCustomers(params) {
  return request({
    url: '/hljt-api/customers/pages',
    method: 'get',
    params
  })
}
// 获取项目产品
export function getProjectProduct(params) {
  return request({
    url: '/hljt-api/projectProduct',
    method: 'get',
    params
  })
}
// 获取项目阶段
export function getProjectNode(params) {
  return request({
    url: '/hljt-api/projectNode',
    method: 'get',
    params
  })
}
// 获取项目成员
export function getProjectMember(params) {
  return request({
    url: '/hljt-api/projectMember',
    method: 'get',
    params
  })
}
// 保存项目交互物
export function postProjectDeliverable(data) {
  return request({
    url: '/hljt-api/projectNodeDeliverable',
    method: 'post',
    data
  })
}
// 获取
export function getProjectDeliverable(params) {
  return request({
    url: '/hljt-api/projectNodeDeliverable',
    method: 'get',
    params
  })
}
// 获取组织架构
export function getDepartments(params) {
  return request({
    url: '/hljt-api/departments/tree',
    method: 'get',
    params
  })
}
// 删除
export function deleteProjectDeliverable(data) {
  return request({
    url: `/hljt-api/projectNodeDeliverable/${data.id}`,
    method: 'delete',
    data
  })
}

// 获取子任务日志列表
export function getNodeTaskLogs(params) {
  return request({
    url: '/hljt-api/nodeTaskLogs/pages',
    method: 'get',
    params
  })
}
// 保存子任务日志列表
export function PostNodeTaskLogs(data) {
  return request({
    url: '/hljt-api/nodeTaskLogs',
    method: 'post',
    data
  })
}
// 编辑子任务日志列表
export function PutNodeTaskLogs(data) {
  return request({
    url: '/hljt-api/nodeTaskLogs',
    method: 'put',
    data
  })
}
// 删除子任务日志列表
export function deleteNodeTaskLogs(data) {
  return request({
    url: `/hljt-api/nodeTaskLogs/${data.id}`,
    method: 'delete',
    data
  })
}
// 获取模板列表
export function getProjectNodet(params) {
  return request({
    url: '/hljt-api/projectNode/templates',
    method: 'get',
    params
  })
}

//获取内存条模块数据
export const reqMemoryModulesList = (page, size) => {
  return request ({
    url:"/memoryModules/pages",
    method:"get",
    params:{
      page,
      size
    }
  })
}
//排产订单列表数据
export const reqProductOrderList = (page, size) => {
  return request ({
    url:"/productionOrderDetails/pages",
    method:"get",
    params:{
      page,
      size
    }
  })
}

//内存条型号导入接口
export const reqMemoryImportExcel = (data) => {
  return request ({
    url:"/memoryModules/importExcel",
    method:"post",
    data:data
  })
}
//排产订单明细导入接口
export const reqOrderImportExcel = (data) => {
  return request ({
    url:"/productionOrderDetails/importExcel",
    method:"post",
    data:data
  })
}

//根据产品编码、物料编码、型号查询列表数据
export const reqMemoryModulesListBySearch = (parentCode, childCode, model) => {
  return request ({
    url:"/memoryModules/pages",
    method:"get",
    params:{
      parentCode,
      childCode,
      model
    }
  })
}

/**
 * 散备件校验相关接口
 */

//根据备货单号 查询产品编号和总数量 stockUpOdd:备货单号
export function reqProductionOrderDetail (stockUpOdd) {
  return request({
    url:"/productionOrderDetails/check/" + stockUpOdd,
    method:"get"
  })
}

//根据备货单号获取校验pass或fail的记录 stockUpOdd备货单 type: 0 | 1
export function reqRecordsByStockUpOdd (stockUpOdd, type) {
  return request ({
    url:"/checkRecords",
    method:"get",
    params:{
      stockUpOdd,
      type
    }
  })
}

//上传备货单校验记录  stockOrderOrTask:备货单号  data:{parentCode:21条码  childCode:09条码  type: 0 | 1}
export function reqRecordsValidate (data) {
  return request({
    url:"/checkRecords",
    method:"post",
    data:data
  })
}

//扫完型号码后与系统基数据进行比对
export function reqComparisonSysData ( parentCode, childCode, model ){
  return request ({
    url:"/memoryModules/check",
    method:"get",
    params:{
      parentCode,
      childCode,
      model
    }
  })
}

//质检员输入密码解锁
export function reqUnlockScreen (password) {
  return request ({
    url:"/dfsUsers/login",
    method:"post",
    data:{
      password:password
    }
  })
}

//保存ip和port
export function reqSaveIpAndPort (configIp, configPort, id, configName, configKey) {
  return request ({
    url:"/configData",
    method:"post",
    data:{
      id:id,
      configName:'default',
      configKey:'default',
      configIp,
      configPort
    }
  })
}

//获取保存的ip和端口
export function reqIpAddressAndPort () {
  return request ({
    url:"/configData/config/key/" + "default",
    method:"get"
  })
}

//测试数据同步临时接口
export function reqSynchronizationDataTest (code) {
  return request ({
    url:"/test/write",
    method:"get",
    params:{
      code
    }
  })
}
